﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using PeopleSource.Entities;
using PeopleSource.Utl;

namespace PeopleSource.Models
{
    public class DQ
    {
        public static IQueryable<Resume> SearchResume(int? resumetype, int? jobtitle, string applyer)
        {
            var data = from r in CH.DB.Resumes select r;
            if (resumetype != null)
                data = data.Where(w => w.ResumeTypeID == resumetype);
            if(jobtitle != null)
                data = data.Where(w => w.JobTitleID == jobtitle);
            if (!string.IsNullOrEmpty(applyer))
                data = data.Where(w => w.Name.Contains(applyer) || w.Mobile.Contains(applyer));

            return data;
        }
    }
}